#include <iostream>
#include <stdio.h>
#include <graphics.h>
#include <time.h>
#include <conio.h>
#include <cstdlib>
using namespace std;

#define ROW 4
#define WIDTH 100 
#define INTERVAL 15

int map[ROW][ROW];
POINT pos[ROW][ROW];

int num[12] = { 0,2,4,8,16,32,64,128,256,512,1024,2048 };

bool flag = false;

enum Color
{
	zero = RGB(205, 193, 180),
	two1 = RGB(238, 228, 218),
	two2 = RGB(237, 224, 200),
	two3 = RGB(242, 177, 121),
	two4 = RGB(245, 149, 99),
	two5 = RGB(246, 124, 95),
	two6 = RGB(246, 94, 59),
	two7 = RGB(242, 177, 121),
	two8 = RGB(237, 204, 97),
	two9 = RGB(255, 0, 128),
	two10 = RGB(145, 0, 72),
	two11 = RGB(242, 17, 158),
	back = RGB(187, 173, 160),
}; Color arr[13] = { zero,two1,two2, two3, two4, two5, two6, two7, two8, two9, two10,two11,back };

int start()
{
	if (rand() % 10 == 1)
	{
		return 4;
	}
	else
	{
		return 2;
	}
}


void createnumber()
{
	while (1)
	{
		int r = rand() % ROW;
		int l = rand() % ROW;
		if (map[r][l] == 0)
		{
			map[r][l] = start();
			break;
		}
	}
}
